# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-pytest-relaxed
pkgver=2.0.0
pkgrel=2
pkgdesc='Relaxed test discovery for pytest'
arch=('any')
license=('BSD')
url='https://github.com/bitprophet/pytest-relaxed'
depends=('python-pytest' 'python-decorator')
makedepends=('python-setuptools')
source=("https://github.com/bitprophet/pytest-relaxed/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('bdbe17c28d03754ad708b1db39779fd4b6f2a29024ec140aa4e2494e47005a71275714bacd0122ee0405832025bd57e5a445821f01b958c71ceaf0c25c51d586')

build() {
  cd pytest-relaxed-$pkgver
  python setup.py build
}

check() {
  # Hack entry points by installing it

  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  cd pytest-relaxed-$pkgver
  python setup.py install --root="$PWD/tmp_install" --optimize=1
  PYTHONPATH="$PWD/tmp_install$site_packages:$PYTHONPATH" pytest
}

package() {
  cd pytest-relaxed-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

# vim:set ts=2 sw=2 et:
